module.exports = app => {
    const { BOOLEAN, STRING, INTEGER, DATE } = app.Sequelize;

    const User = app.model.define('user', {
        id: {
            type: INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        login: BOOLEAN,
        sign: BOOLEAN,
        num: STRING(20),
        name: STRING(30),
        vote: {
            type: BOOLEAN,
            defaultValue: false
        },
        prize: {
            type: BOOLEAN,
            defaultValue: false
        },
        bless: STRING(300),
        last_sign_in_at: DATE,
        created_at: DATE,
        updated_at: DATE
    });



    // User.findByLogin = function* (login) {
    //     return yield this.findOne({ login: login });
    // }

    // User.prototype.logSignin = function* () {
    //     yield this.update({ last_sign_in_at: new Date() });
    // }

    return User;
};